const Koa = require('koa')
const Router = require('koa-router')
const port = process.env.PORT || 5000

const app = new Koa()
const router = new Router()

//中间件
const middlewareDruation = require('./middleware/Duration')
const middlewareHeader = require('./middleware/Header')
const middlewareData = require('./middleware/Data')

app.use(middlewareDruation)
app.use(middlewareHeader)
app.use(middlewareData) 

app.use(router.routes()).use(router.allowedMethods())
app.listen(port, () => {
    console.log('server is running at http://localhost:5000')
})
  